from flask import Flask,render_template,request
from vsearch import search4letters
app = Flask(__name__)
# 中央管理中心是如何运转？
# 看左边的资源管理页面，一共有两个（entry，results）

# @app.route('/')
@app.route('/entry',methods=['GET','POST'])
def entry():
    return render_template('entry.html',the_title="这是我的期末项目")

@app.route('/search4',methods=['GET','POST'])
def results():
    phrase = request.form['phrase']
    letters = request.form['letters']
    title = 'Here are your results: '
    results = str(search4letters(phrase, letters))
    return render_template('results.html', the_title=title, the_phrase=phrase, the_letters=letters, the_results=results)

@app.route('/')
@app.route('/index',methods=['GET','POST'])
def index_page():
    return render_template('index.html')

if __name__ == '__main__':
    app.run(debug=True)

